Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make OpenMetrics use the RequestsWrapper #5414

Merged
merged 15 commits into from
Jan 9, 2020
Merged

Make OpenMetrics use the RequestsWrapper #5414

merged 15 commits into from
Jan 9, 2020

Conversation

ofek
Copy link
Contributor

@ofek ofek commented Jan 8, 2020

Motivation

Standardize config for all checks

@codecov
Copy link

codecov bot commented Jan 8, 2020

Codecov Report

Merging #5414 into master will decrease coverage by 0.06%.
The diff coverage is 93.54%.

Impacted Files Coverage Δ
crio/tests/test_crio.py 100% <100%> (ø) ⬆️
linkerd/tests/test_linkerd.py 87.8% <100%> (ø) ⬆️
...inx_ingress_controller/nginx_ingress_controller.py 100% <100%> (ø) ⬆️
...e_metrics_server/tests/test_kube_metrics_server.py 100% <100%> (ø) ⬆️
kube_proxy/datadog_checks/kube_proxy/kube_proxy.py 100% <100%> (ø) ⬆️
kube_proxy/tests/test_kube_proxy.py 100% <100%> (ø) ⬆️
...ller_manager/tests/test_kube_controller_manager.py 100% <100%> (ø) ⬆️
..._checks/kube_metrics_server/kube_metrics_server.py 100% <100%> (ø) ⬆️
...tadog_checks/base/checks/openmetrics/base_check.py 91.83% <100%> (+0.34%) ⬆️
linkerd/datadog_checks/linkerd/linkerd.py 100% <100%> (ø) ⬆️
... and 225 more

Copy link
Member

@AlexandreYang AlexandreYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome if all CI pass.

Left few comments.

'ssl_cert': {'name': 'tls_cert'},
'ssl_private_key': {'name': 'tls_private_key'},
'ssl_ca_cert': {'name': 'tls_ca_cert'},
'prometheus_timeout': {'name': 'timeout'},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mean we need to update all integrations config examples?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, though they'd still work of course so no rush

@codecov
Copy link

codecov bot commented Jan 8, 2020

Codecov Report

Merging #5414 into master will increase coverage by 0.07%.
The diff coverage is 96.92%.

Impacted Files Coverage Δ
linkerd/tests/test_linkerd.py 87.8% <100%> (ø) ⬆️
...e_metrics_server/tests/test_kube_metrics_server.py 100% <100%> (ø) ⬆️
kube_proxy/tests/test_kube_proxy.py 100% <100%> (ø) ⬆️
...ller_manager/tests/test_kube_controller_manager.py 100% <100%> (ø) ⬆️
..._controller/tests/test_nginx_ingress_controller.py 100% <100%> (ø) ⬆️
...tadog_checks/base/checks/openmetrics/base_check.py 91.83% <100%> (+0.34%) ⬆️
linkerd/datadog_checks/linkerd/linkerd.py 100% <100%> (ø) ⬆️
kubelet/tests/test_cadvisor.py 96.49% <100%> (ø) ⬆️
kubelet/tests/test_kubelet.py 96.78% <100%> (ø) ⬆️
crio/datadog_checks/crio/crio.py 100% <100%> (ø) ⬆️
... and 202 more

if bearer_token is not None:
headers['Authorization'] = 'Bearer {}'.format(bearer_token)

# TODO: Determine if we really need this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Determine if we really need this

Can we determine now? What's needed to answer this question? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if self._client_token_path:
self.renew_client_token()
else:
self.set_client_token(self._client_token)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why changes are needed in vault ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It had to do with where create_scraper_configuration was called

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, why

Actually, I’m not sure, why 

if self._client_token_path:
self.renew_client_token()


has been moved inside the `if condition` old line 232.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renew_client_token calls set_client_token, set_client_token updates self.http_handlers[self._scraper_config['prometheus_url'], prometheus_url wasn't set until next block

Copy link
Member

@mgarabed mgarabed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏅

@ofek ofek merged commit 9628f7b into master Jan 9, 2020
@ofek ofek deleted the ofek/o branch January 9, 2020 15:56
@AlexandreYang AlexandreYang mentioned this pull request Jan 10, 2020
4 tasks
AlexandreYang pushed a commit that referenced this pull request Jan 30, 2020
* Make OpenMetrics use the RequestsWrapper

* fix crio

* fix kube_controller_manager

* fix kube_metrics_server

* fix kube_proxy

* fix kube_scheduler

* fix linkerd

* fix nginx_ingress_controller

* fix openmetrics

* refactor

* final refactor

* fix headers

* fix kubelet

* add note

* address reviews
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants